<template>
	<view>
		<image src="../../static/logo-12.png" class="logo" mode="widthFix"></image>
		<view class="logo-title">会言通在线办公协同系统</view>
		<view class="logo-subtitle">1.0</view>
		<view>
			<button class="login-btn" open-type="getUserInfo" @tap="login()">登陆系统</button>
		</view>
		<view class="register-container">
			没有账号？
			<text class="register" @tap="toRegister()">立即注册</text>
		</view>
		
	</view>
</template>

<script>
	export default {
	  methods: {
	    toRegister() {
	      uni.navigateTo({
	        url: "../register/register"
	      });
	    },
	    login:function(){
	    					let that = this
	    					uni.login({
	    						provider:"weixin",
	    						success:function(resp){
	    							 let code = resp.code
	    							 that.ajax(that.url.login,"POST",{code},function(resp){
	    								 let permission = resp.data.permission
	    								 uni.setStorageSync("permission",permission)
										 
										 uni.switchTab({
										     url: "../index/index"
										 })
	    							 })
	    							 console.log("login success")
	    							 //TODO 跳转到展示页面
									 
	    						},
	    						fail:function(e){
	    							console.log(e)
	    							uni.showToast({
	    								icon:"none",
	    								title: '执行异常'
	    							});
	    						}
	    					})
	    				},
		
		
		
	  }
	};
</script>

<style lang="less">
	@import url('login.less'); 
</style>